#ifndef __Threadpool_H__
#define __Threadpool_H__

#include "Task.h"
#include "TaskQueue.h"
#include "Thread.h"

#include <memory>
#include <vector>

using std::unique_ptr;
using std::vector;

namespace wd
{

//class Thread;//类的前向声明
class Threadpool
{
public:
    Threadpool(size_t threadNum, size_t queSize);
    ~Threadpool();

    void start();
    void stop();
    void addTask(Task task);
private:
    //每一个子线程要做的事儿
    void doTask();

private:
    vector<unique_ptr<Thread>> _threads;
    size_t                     _threadNum;
    TaskQueue                  _taskque;
    bool                       _isExit;

};

}//end of namespace wd


#endif

